package com.barbeque.mall.service.wx;

import com.barbeque.mall.bean.advertise.MarketAd;
import com.barbeque.mall.bean.advertise.MarketAdExample;
import com.barbeque.mall.mapper.MarketAdMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 苏东宇
 * @since 2022/07/20 23:59
 */
@Service
public class WxAdServiceImpl  implements WxAdService{

    @Autowired
    MarketAdMapper marketAdMapper;


    /**
     * 查找所有广告
     * @return java.util.List<com.barbeque.mall.bean.advertise.MarketAd>
     * @author 苏东宇
     * @since 2022/07/21 9:31
     */
    @Override
    public List<MarketAd> getAllAds() {

        MarketAdExample marketAdExample = new MarketAdExample();
        MarketAdExample.Criteria criteria = marketAdExample.createCriteria();
        criteria.andDeletedEqualTo(false);
        PageHelper.startPage(1, 20);
        List<MarketAd> marketAds = marketAdMapper.selectByExample(marketAdExample);

        return marketAds;
    }
}
